/*----------------------------------------------------------------------------*/
/* Team 3647
/* Loader.java
/* Collector and feeder controls  
/*----------------------------------------------------------------------------*/
package edu.wpi.first.wpilibj.templates;

import edu.wpi.first.wpilibj.Solenoid;
import edu.wpi.first.wpilibj.Victor;

public class Loader {

    private static Victor BottomLoader = new Victor(4);
    private static Victor TopLoader    = new Victor(5);
    private static Victor Collector    = new Victor(6);
    private static Solenoid CollectorUpValve   = new Solenoid(2);
    private static Solenoid CollectorDownValve = new Solenoid(1);
    
    private static boolean stopped = false, value = false;
    public static void CollectorManipulate() {
        if (JoySticks.CollectorPosition && !stopped) {
            value = !value;
            if (value) {
                CollectorUp();
            } else {
                CollectorDown();
            }
            stopped = true;
        } else if (!JoySticks.CollectorPosition) {
            stopped = false;
        }
    }

    public static void CollectorUp() {
        CollectorUpValve.set(true);
        CollectorDownValve.set(false);
    }

    public static void CollectorDown() {
        CollectorDownValve.set(true);
        CollectorUpValve.set(false);
    }

    public static void LoaderRun() {
        if (JoySticks.ShooterFeed) {
            BottomLoader.set(1); //Disk Up
        } else if (JoySticks.ReverseShooterFeed) {
             BottomLoader.set(-1); //Disk Down
        }else {
            BottomLoader.set(0);
        }

        if (JoySticks.TopShooterFeed) {
            TopLoader.set(1); //Disk Up 
        } else if (JoySticks.TopShooterReverse) {
            TopLoader.set(-1); //Disk Down
        } else {
            TopLoader.set(0);
        }

        if (JoySticks.CollectorFeed1 || JoySticks.CollectorFeed2 ) {
            Collector.set(-1); //Up
            TopLoader.set(-.8); //Helps Bring up 
            BottomLoader.set(.8);
        } else {
            Collector.set(0);
        }
    }
    
    public static void LoaderFeed() {
        BottomLoader.set(1);
        TopLoader.set(1);
    }
    
    public static void LoaderKill() {
        BottomLoader.set(0);
        TopLoader.set(0);
        Collector.set(0);
    }
}
